package com.sun.springboot_mq.hello.sender;

import com.sun.springboot_mq.hello.entry.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author shkstart
 * @create 2021-10-24 17:48
 */
@Component
public class ObjectSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(User user){
        System.out.println("Send发送方:"+user);
        this.rabbitTemplate.convertAndSend("object",user);
    }
}
